package com.ehotting.edsta.mqbd.reliability.api.bean;

import com.ehotting.mqbd.api.bean.MQBaseData;
import com.ehotting.mqbd.api.bean.MqApplicationContext;
import com.ehotting.mqbd.api.enums.ProtocolTypeEnum;
import com.ehotting.mqbd.api.enums.TopicEnum;
import com.ehotting.edsta.mqbd.reliability.api.domain.AnsysRunnerModel;
import com.ehotting.edsta.mqbd.reliability.api.domain.SimulateResultDto;
import org.springframework.util.Assert;

public class MQReliabilityData extends MQBaseData<AnsysRunnerModel,SimulateResultDto> {

    private AnsysRunnerModel request;
    private SimulateResultDto response;
    private String requestUrl;

    public MQReliabilityData() {
        super();
        this.setProtocolType(ProtocolTypeEnum.HTTP);
    }

    public MQReliabilityData(TopicEnum topic, String consumerHost, String localHost, String agentId, String module, String msg) {
        super( topic, consumerHost,  localHost,  agentId,  module,  msg);
        this.setProtocolType(ProtocolTypeEnum.HTTP);
    }

    public MQReliabilityData(TopicEnum topic, MqApplicationContext mqApplicationContext, String agentId, String module, String msg) {
        super( topic, mqApplicationContext.getConsumerHost(),  mqApplicationContext.getLocalHost(),  agentId,  module,  msg);
        this.setProtocolType(ProtocolTypeEnum.HTTP);
    }


    public static MQReliabilityData create(TopicEnum topic, String consumerHost, String localHost, String agentId, String module, String msg){
        Assert.notNull(topic,"topic is null");
        return new MQReliabilityData( topic, consumerHost,  localHost,  agentId,  module,  msg);
    }

    public static MQReliabilityData create(TopicEnum topic, MqApplicationContext mqApplicationContext, String agentId, String msg){
        Assert.notNull(topic,"topic is null");
        return new MQReliabilityData( topic, mqApplicationContext,  agentId,  mqApplicationContext.getModule(),  msg);
    }

    public AnsysRunnerModel getRequest() {
        return request;
    }

    public void setRequest(AnsysRunnerModel request) {
        this.request = request;
    }

    public SimulateResultDto getResponse() {
        return response;
    }

    public void setResponse(SimulateResultDto response) {
        this.response = response;
    }

    public String getRequestUrl() {
        return requestUrl;
    }

    public void setRequestUrl(String requestUrl) {
        this.requestUrl = requestUrl;
    }
}
